#pragma once
#include "stdint.h"
#include <stdexcept>
#include <memory>
#include <vector>
#include <string>

using std::runtime_error;

using std::vector;

using std::shared_ptr;
using std::weak_ptr;
using std::unique_ptr;
using std::make_shared;

#if defined _WIN32 || defined WIN32
#include <Windows.h>
//#elif defined X11
#else
#include <ctime>
#include <sys/time.h>
#include <pthread.h>
#endif

#define WIDEN2(x) L ## x
#define WIDEN(x) WIDEN2(x)
#define __WFILE__ WIDEN(__FILE__)

#if defined _WIN32 || defined WIN32
    #define E_CHAR wchar_t
	#define E_STRING std::wstring
    #define E(str) L##str
    #define E_VSNPRINTF(buf, size, fmt, ...) _vsnwprintf(buf, size, fmt, __VA_ARGS__)

	#define _E_FILE_ __WFILE__

	#define GETTHREADID() GetCurrentThreadId()

	#define GETTIME SYSTEMTIME sysTime; GetLocalTime(&sysTime);
	#define TIME_HOUR sysTime.wHour
	#define TIME_MINUTE sysTime.wMinute
	#define TIME_SECOND sysTime.wSecond
	#define TIME_MSECOND sysTime.wMilliseconds

	#ifdef VENGINE_EXPORT
		#define E_DLL_DECL __declspec(dllexport)
	#else
		#define E_DLL_DECL __declspec(dllimport)
	#endif //VENGINE_EXPORT
#else
    #define E_CHAR char
	#define E_STRING std::string
	#define E(str) str
    #define E_VSNPRINTF(buf, size, fmt, ...) vsnprintf(buf, size, fmt, __VA_ARGS__)

	#define _E_FILE_ __FILE__

	#define GETTHREADID() (unsigned int)(unsigned long)pthread_self()

	#define GETTIME timeval uTime; struct tm* localTime; gettimeofday(&uTime, NULL); localTime = localtime(&uTime.tv_sec);
	#define TIME_HOUR localTime->tm_hour
	#define TIME_MINUTE localTime->tm_min
	#define TIME_SECOND localTime->tm_sec
	#define TIME_MSECOND (int)uTime.tv_usec

	#define E_DLL_DECL extern "C"
#endif

